import axios from "axios";
import { REQ_GET_NEWS } from "../constants/new";
/**
 * 根据id获取相应的频道的数据
 * @returns 
 */
 export const reqGetNews = (id) => {
  return async dispatch => {
    const res = await axios.get(`http://geek.itheima.net/v1_0/articles?channel_id=${id}&timestamp=${Date.now()}`)
    dispatch({
      type:REQ_GET_NEWS,
      payload:res.data.data.results
    })
  }

}